package com.hljx.service.impl;

import com.hljx.dto.DateDTO;
import com.hljx.entity.WorkloadSummary;
import com.hljx.excel.ExcelTransfer;
import com.hljx.mapper.sys.WorkloadSummaryMapper;
import com.hljx.service.WorkloadSummaryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hljx.vo.SysDictVO;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2023-11-29
 */
@Service
public class WorkloadSummaryServiceImpl extends ServiceImpl<WorkloadSummaryMapper, WorkloadSummary> implements WorkloadSummaryService {
    @Autowired
    private ExcelTransfer<WorkloadSummary> excelTransfer;
    @Override
    public List<WorkloadSummary> listByPage(DateDTO dateDTO) {
        return baseMapper.listByPage(dateDTO);
    }

    @Override
    public void export(DateDTO dto, HttpServletResponse response) throws ClassNotFoundException {
        List<WorkloadSummary> workloadSummaries = baseMapper.listByPage(dto);
        excelTransfer.exportExcel(response, workloadSummaries, "工作量指标分值", "sheet1", WorkloadSummary.class);

    }
}
